package com.usercenter.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 静态资源映射：将 /images/** 映射到 uploads 目录
        String uploadsDir = new java.io.File(System.getProperty("user.dir"),
                "uploads").getAbsolutePath();
        registry.addResourceHandler("/images/**")
                .addResourceLocations("file:" + uploadsDir + "/");
    }
} 